<template>
  <h1>总和:{{total}}</h1>
  <div class="row">
    <one-box
        v-for="item in stus"
        :num="item.num"
        :name="item.name"
        @add="handleAdd"
        @minus="handleMinus"
    ></one-box>
  </div>
</template>

<script>
import OneBox from "@/components/OneBox.vue";
export default {
  name: "RowView",
  components: {OneBox},
  data(){
    return{
      stus:[
        {name:'jack',num:21},
        {name:'tom',num:98},
        {name:'rose',num:56},
      ],
      total:0,
    }
  },
  created(){
    for(let item of this.stus){
      this.total += item.num
    }
  }
}
</script>

<style scoped>
.row{
  display: flex;
}
</style>